package com.bank.entity.vo;

import com.bank.entity.constant.ResponseEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: Lixy
 * @email: 1908598362@qq.com
 * @date: 2021/12/31 星期五 20:11
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Response {
    private  Integer code;
    private  String msg;
    private  Object data;
    private ResponseEnum responseEnum;

    public Response(ResponseEnum responseEnum) {
        this.responseEnum = responseEnum;
        this.code = responseEnum.getCode();
        this.msg = responseEnum.getMsg();
    }
    public static Response response1(ResponseEnum responseEnum,Object data,String msg){
        Response response = new Response(responseEnum);
        response.setData(data);
        response.setMsg(msg);
        return response;
    }

    public static Response response2(ResponseEnum responseEnum, Object data){
        Response response = new Response(responseEnum);
        response.setData(data);
        return response;
    }

    public static Response response3(ResponseEnum responseEnum,String msg){
        Response response = new Response(responseEnum);
        response.setMsg(msg);
        return response;
    }
}
